home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / zendisk1.zip / LST10-6.ASM < prev    next >
Assembly Source File  |  1990-02-15  |  580b  |  26 lines

  1. ;
  2. ; *** Listing 10-6 ***
  3. ;
  4. ; Searches a word-sized array for the first element
  5. ; greater than 10,000, using LODSW & CMP.
  6. ;
  7.     jmp    Skip
  8. ;
  9. WordArray    dw    1000 dup (0), 10001
  10. ;
  11. Skip:
  12.     call    ZTimerOn
  13.     mov    si,offset WordArray
  14.             ;array to search
  15.     mov    dx,10000 ;value we'll compare with
  16.     cld        ;make LODSW add 2 to SI after each
  17.             ; execution
  18. SearchLoop:
  19.     lodsw        ;get the next element
  20.     cmp    dx,ax    ;compare the element to 10,000
  21.     jae    SearchLoop ;if not greater than 10,000, do
  22.                ; the next element
  23.     dec    di    ;point back to the matching word
  24.     dec    di
  25.     call    ZTimerOff
  26.